using Sage.Http.Content;
using Sage.Http.Core;
using Sage.Http.Models;
using System.Net.Http.Headers;
using System.Text;

namespace Sage.Http.Extensions
{
    /// <summary>
    /// 为HttpClient提供请求构建器功能的扩展方法
    /// </summary>
    public static class HttpClientBuilderExtensions
    {
        /// <summary>
        /// 创建HTTP请求构建器，用于流式API构建请求
        /// </summary>
        /// <param name="client">HTTP客户端</param>
        /// <param name="method">HTTP方法</param>
        /// <param name="requestUri">请求URI</param>
        /// <returns>HTTP请求构建器</returns>
        /// <exception cref="ArgumentNullException">参数为null时抛出</exception>
        /// <remarks>
        /// 此方法返回一个流式API构建器，用于链式构建HTTP请求。
        /// 此方法已过时，请使用HttpClientExtensions.CreateRequest方法。
        /// </remarks>
        [Obsolete("此方法已过时，请使用HttpExtensions.CreateRequest方法")]
        public static HttpRequestBuilder CreateRequest(
            this HttpClient client,
            HttpMethod method,
            string requestUri)
        {
            return HttpExtensions.CreateRequest(client, method, requestUri);
        }
        
        /// <summary>
        /// 获取文件扩展名对应的MIME类型
        /// </summary>
        /// <param name="extension">文件扩展名（包含或不包含前导点）</param>
        /// <returns>MIME类型，如果未知则返回application/octet-stream</returns>
        [Obsolete("此方法已过时，请使用HttpUtilities.GetMimeTypeForFileExtension方法")]
        public static string GetMimeTypeForFileExtension(string extension)
        {
            return Utilities.HttpUtilities.GetMimeTypeForFileExtension(extension);
        }
    }
}
